﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace test_6_17
{
    public partial class Form4 : Form
    {
        public Form4()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            int n = 1000;
            
            while(n>0)
            {
                bool b = true;
                for (int i=2;i<n;i++)
                {
                    if(n%i==0)
                    {
                        b = false;
                        break;
                    }
     
                }
                if(b==true)
                {
                    textBox1.Text += n + " ";
                }
                n--;
            }
        }
    }
}
